package com.hmall.common.intercepter;


import com.hmall.utils.UserThreadLocal;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class MyFeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {

        String userId = UserThreadLocal.get();
        log.info("===userId: {}", userId);
        if (userId != null){
            template.header("Authorization", userId);
        }

    }
}